/*******************************************************************
 *
 * Copyright (C), 2021-2022, LS, All rights reserved.
 *
 * Author      : 
 * Create Time : 2020-12-17
 * Version     : v0.1
 * Description : 
 *******************************************************************/
 
/*----------------------------Head file----------------------------*/
#include "wm.h"
#include "string.h"
#include "app_battery.h"
#include "app_skip_alg.h"
#include "app_global_data.h"

/*----------------------------macro file---------------------------*/

/*----------------------------type define--------------------------*/

/*----------------------------var define---------------------------*/

/*-------------------------func declaration------------------------*/
static void charging_disp_sec_update(void);

/*-----------------------------------------------------------------*/

void wm_batt_low_lock_disp(void)
{
    wm_t wm;

    memset(&wm, 0, sizeof(wm));
    wm.cur_win = NO_WIN;
    wm.disp_off_cnt = WARN_DISP_CNT;

    wm_info_set(&wm);

    app_skip_mode_set(SKIP_MODE_NULL);

    app_disp_img_all_clear();
    app_disp_batt_lvl(0);
    app_disp_batt_lo();
    //app_disp_update();
    
    app_disp_backlight_set(true);
}


#if(BATT_CHARGE_ENABLE)

void wm_batt_charging_disp(void)
{
    wm_t wm;

    memset(&wm, 0, sizeof(wm));
    wm.cur_win = NO_WIN;
    wm.revert_win = wm_get_revert_win();
    wm.short_press_cb = wm_charge_bl_off_cnt_reset;
    wm.auto_update_1hz_cb = charging_disp_sec_update;
    wm.disp_off_cnt = DISP_NEVER_OFF_CNT;

    wm_info_set(&wm);

    app_skip_mode_set(SKIP_MODE_NULL);

    /////app_disp_clear();
    app_disp_bt_icon();
    app_disp_charge_state(true);
    //app_disp_update();
    
    app_disp_backlight_set(true);
}


static void charging_disp_sec_update(void)
{
    app_disp_bt_icon();
    app_disp_charge_state(false);

    //app_disp_update();
    if(false == app_batt_charge_state_get()) {
        wm_set_disp_off_cnt(0);
    }
}

#endif
